import React, { PureComponent, createRef } from "react"

export class HelloWorld extends PureComponent {
    constructor() {
        super()
    }

    test(){
        console.log("test");
    }

    render() {
        return <h1>Hello World</h1>
    }
}

export class App extends PureComponent {
    constructor() {
        super()
        this.hwRef = createRef()
    }

    getNativeDOM() {
        console.log(this.hwRef.current)
    }
    render() {
        return (
            <div>
                <HelloWorld ref={this.hwRef} />
                <button onClick={(e) => this.getNativeDOM()}>获取DOM</button>
            </div>
        )
    }
}

export default App
